<?php

/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Sitealbum
 * @copyright  Copyright 2010-2011 BigStep Technologies Pvt. Ltd.
 * @license    http://www.socialengineaddons.com/license/
 * @version    $Id: Global.php 2011-08-026 9:40:21Z SocialEngineAddOns $
 * @author     SocialEngineAddOns
 */
class Sitealbum_Form_Admin_Global extends Engine_Form {

  public function init() {

    $this
            ->setTitle('Global Settings')
            ->setDescription('These settings affect all members in your community.');

    $this->addElement('Text', 'sitealbum_lsettings', array(
        'label' => 'Enter License key',
        'description' => "Please enter your license key that was provided to you when you purchased this plugin. If you do not know your license key, please contact the Support Team of SocialEngineAddOns from the Support section of your Account Area.(Key Format: XXXXXX-XXXXXX-XXXXXX )",
        'value' => Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.lsettings'),
    ));

    $global_settings_file = APPLICATION_PATH . '/application/settings/general.php';
    if (file_exists($global_settings_file)) {
      $generalConfig = include $global_settings_file;
    } else {
      $generalConfig = array();
    }
    if ((!empty($generalConfig['environment_mode'])) && ($generalConfig['environment_mode'] != 'development')) {
      $this->addElement('Checkbox', 'environment_mode', array(
          'label' => 'Your community is currently in "Production Mode". We recommend that you momentarily switch your site to "Development Mode" so that the CSS of this plugin renders fine as soon as the plugin is installed. After completely installing this plugin and visiting few pages of your site, you may again change the System Mode back to "Production Mode" from the Admin Panel Home. (In Production Mode, caching prevents CSS of new plugins to be rendered immediately after installation.)',
          'description' => 'System Mode',
          'value' => 1,
      ));
    } else {
      $this->addElement('Hidden', 'environment_mode', array('order' => 990, 'value' => 0));
    }

    // Add submit button
    $this->addElement('Button', 'submit_lsetting', array(
        'label' => 'Activate Your Plugin Now',
        'type' => 'submit',
        'ignore' => true
    ));

    $this->addElement('Radio', 'sitealbum_photo_badge', array(
        'label' => 'Photos Badge',
        'description' => 'Do you want users to be able to create their Photo Badges? Photo badges will enable users to show off their photos on external blogs or websites. Multiple configuration options will enable them to create attractive badges.',
        'multiOptions' => array(
            1 => 'Yes',
            0 => 'No'
        ),
        'value' => Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.photo.badge', 1),
    ));

//    $this->addElement('Radio', 'sitealbum_photo_makeprofile', array(
//        'label' => 'Make Profile Photo',
//        'description' => 'Do you want users to be able to make the album photos that they can view as their profile photo? If enabled, users will see a "Make Profile Photo" link below the album photos.',
//        'multiOptions' => array(
//            1 => 'Yes',
//            0 => 'No'
//        ),
//        'value' => Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.photo.makeprofile', 1),
//    ));
//
//    $this->addElement('Radio', 'sitealbum_photo_download', array(
//        'label' => 'Download',
//        'description' => 'Do you want users to be able to download the album photos that they can view? If enabled, users will see a "Download" link below the album photos.',
//        'multiOptions' => array(
//            1 => 'Yes',
//            0 => 'No'
//        ),
//        'value' => Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.photo.download', 1),
//    ));

    $this->addElement('Radio', 'sitealbum_photo_specialalbum', array(
        'label' => 'Show / Hide Default Albums',
        'description' => "Do you want to show default albums of members on your site which are created by the system automatically ? [Note: If you click on 'No' then the albums like 'Profile Photos', 'Wall Photos', 'Blog Photos' and 'Message Photos' etc will not be shown to members on the site except on 'Browse Albums Page' and 'Member Profile Page'. In case you do not want to show such photos at these 2 pages also, you can follow the instructions given on the link when you will click on the 'No' option below.]",
        'multiOptions' => array(
            1 => 'Yes',
            0 => 'No'
        ),
        'onclick' => 'showwarning(this.value);',
        'value' => Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.photo.specialalbum', 1),
    ));

    $this->addElement('Radio', 'sitealbum_comment_view', array(
        'label' => 'Comment View in Albums',
        'description' => 'Do you want Comment View to be available in the main album page? Comment View displays comments on all photos of an album in a nice manner.',
        'multiOptions' => array(
            1 => 'Yes',
            0 => 'No'
        ),
        'value' => Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.comment.view', 1),
    ));
    
    $this->addElement('Radio', 'sitealbum_lightbox_onloadshowthumb', array(
        'label' => 'Opening Loader Image in Lightbox',
        'description' => 'Do you want a loader image to be shown in the lightbox viewer while the complete photo is being loaded? (If you select "No" over here, then users will see the photo while it is being loaded. Note: If the clicked photo is private then also the photo will be partially shown to un-authorized users if you select "No".)',
        'multiOptions' => array(
            0 => 'Yes',
            1 => 'No'
        ),
        'value' => Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.lightbox.onloadshowthumb', 1),
    ));
    // sHOW IN LIGHTBOX
//    $this->addElement('Radio', 'sitealbum_photolightbox_show', array(
//        'label' => 'Advanced Lightbox Display',
//        'description' => 'Do you want to enable advanced lightbox display for album photos? (This setting will be applied at all places where photos of albums are viewed by users. To enable lightbox display for photos in activity feeds, please visit the "Activity Feeds" section/tab.)',
//        'multiOptions' => array(
//            1 => 'Yes',
//            0 => 'No'
//        ),
//        'onclick' => 'showphotolightboxBg(this.value); showphotolightboxFont(this.value);showads(this.value)',
//        'value' => Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.photolightbox.show', 1),
//    ));
//    // COLOR VALUE FOR BACKGROUND COLOR
//    $this->addElement('Text', 'sitealbum_photolightbox_bgcolor', array(
//        'decorators' => array(
//            array('ViewScript', array(
//                    'viewScript' => '_formImagerainbowLightBoxBg.tpl',
//                    'class' => 'form element'
//            )))
//    ));
//
//    // COLOR VALUE FOR FONT COLOR
//    $this->addElement('Text', 'sitealbum_photolightbox_fontcolor', array(
//        'decorators' => array(
//            array('ViewScript', array(
//                    'viewScript' => '_formImagerainbowLightBoxFont.tpl',
//                    'class' => 'form element'
//            )))
//    ));
    // Enable Communityad plugin
//    if (Engine_Api::_()->getDbtable('modules', 'core')->isModuleEnabled('communityad')) {
//      // Element: sitealbum_lightboxads
//      $this->addElement('Radio', 'sitealbum_lightboxads', array(
//          'label' => 'Community Ads in Photos Lightbox',
//          'description' => 'Do you want Community Ads to be shown in the Advanced Photos Lightbox?',
//          'multiOptions' => array(
//              1 => 'Yes',
//              0 => 'No'
//          ),
//          'onclick' => 'showlightboxads(this.value)',
//          'value' => Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.lightboxads', 1),
//      ));
//      // Element: sitealbum_adtype
//      $this->addElement('Radio', 'sitealbum_adtype', array(
//          'label' => 'Type of Community Ads in Photos Lightbox',
//          'description' => 'What type of Community Ads do you want to be shown in the Advanced Photos Lightbox?',
//          'multiOptions' => array(
//              3 => 'All',
//              2 => 'Sponsored Ads',
//              1 => 'Featured Ads',
//              0 => 'Both Sponsored and Featured Ads'
//          ),
//          'value' => Engine_Api::_()->getApi('settings', 'core')->getSetting('sitealbum.adtype', 3),
//      ));
//    }

    $view = Zend_Registry::isRegistered('Zend_View') ? Zend_Registry::get('Zend_View') : null;
    $description = sprintf(Zend_Registry::get('Zend_Translate')->_('The settings for the Advanced Lightbox Viewer have been moved to the SocialEngineAddOns Core Plugin. Please %1svisit here%2s to see and configure these settings.'), "<a href='" . $view->baseUrl() . "/admin/seaocore/settings/lightbox" . "' target='_blank'>", "</a>");
    $this->addElement('Dummy', 'sitealbum_photolightbox_show', array(
        'label' => 'Photos Lightbox Viewer',
        'description' => $description,
    ));

    $this->getElement('sitealbum_photolightbox_show')->getDecorator('Description')->setOptions(array('placement', 'APPEND', 'escape' => false));
    // Element: submit
    $this->addElement('Button', 'submit', array(
        'label' => 'Save Changes',
        'type' => 'submit',
        'ignore' => true
    ));
  }

}

?>